<?php
/************************FoxPHP威客系统************************/
/*                                                            */
/*  FoxPHP.Com (C)2006-2016 FoxPHP Inc.                       */
/*  This is NOT a freeware, use is subject to license terms   */
/*  FoxPHP威客系统是商业软件,使用于商业用途请购买授权         */
/*  V3.0 2016.3                                               */
/*  foxphp@aliyun.com                                         */
/*  http://www.foxphp.com                                     */
/*                                                            */
/**************************************************************/

namespace Post\Controller;
$_POST['datatype']='json';
class MemberController extends \Member\Controller\IndexController {
	
	//头像上传
	//地址 /post/member/avatar
	public function avatarAction(){

		$model=new \Member\Model\MemberModel();
		
		$model->UploadAvatar();
    }
	
	//用户信息
	//地址 /post/member/info
	public function infoAction(){
		if(intval($_GET['mobile'])){
			//移动
		}else{
			if(IsPost('Submit')){
				//模块
				$model=new \Member\Model\MemberModel();
				$result=$model->UpdateMember('info');
				$this->ajaxReturn(array('title'=>'保存成功','message'=>'保存成功!','status'=>'ok','refresh'=>true),$_POST['datatype']);
				/*
				if($model->UpdateMember('info')){
					$this->ajaxReturn(array('title'=>'保存成功','message'=>'保存成功!','status'=>'ok','refresh'=>true),$_POST['datatype']);
				}else{
					$this->ajaxReturn(array('title'=>'保存失败','message'=>'保存数据失败！','status'=>'error'),$_POST['datatype']);
				}
				*/
			}else{
				$this->ajaxReturn(array('title'=>'验证失败','message'=>'没有数据提交！','status'=>'error'),$_POST['datatype']);
			}
		}
	}
	
	//联系方式
	//地址 /post/member/contact
	public function contactAction(){
		if(intval($_GET['mobile'])){
			//移动
		}else{
			if(IsPost('Submit')){
				//模块
				$model=new \Member\Model\MemberModel();
				$result=$model->UpdateMember('contact');
				$this->ajaxReturn(array('title'=>'保存成功','message'=>'保存成功!','status'=>'ok','refresh'=>true),$_POST['datatype']);
				/*
				if($result){
					$this->ajaxReturn(array('title'=>'保存成功','message'=>'保存成功!','status'=>'ok','refresh'=>true),$_POST['datatype']);
				}else{
					$this->ajaxReturn(array('title'=>'保存失败','message'=>'保存数据失败！'.$result,'status'=>'error'),$_POST['datatype']);
				}
				*/
			}else{
				$this->ajaxReturn(array('title'=>'验证失败','message'=>'没有数据提交！'.$result,'status'=>'error'),$_POST['datatype']);
			}
		}
	}

	//用户开店
	//地址 /post/member/openshop
	public function openshopAction(){
		if(intval($_GET['mobile'])){
			//移动
		}else{
			if(IsPost('Submit')){
				//模块
				$model=new \Member\Model\MemberModel();
				if($model->UpdateMember('shop')){
					$this->ajaxReturn(array('title'=>'保存成功','message'=>'保存成功!','status'=>'ok','refresh'=>true,'url'=>'/seller/shop/auth'),$_POST['datatype']);
				}else{
					$this->ajaxReturn(array('title'=>'保存失败','message'=>$model->getError(),'status'=>'error'),$_POST['datatype']);
				}
			}else{
				$this->ajaxReturn(array('title'=>'验证失败','message'=>'没有数据提交！','status'=>'error'),$_POST['datatype']);
			}
		}
	}
	
	//支付宝帐号
	public function bankcardAction(){
		if(intval($_GET['mobile'])){
			//移动
		}else{
			//模块
			$model=new \Member\Model\MemberModel();
			if($model->UpdateMember('bankcard')){
				$this->ajaxReturn(array('title'=>'设置成功','message'=>'设置成功!','status'=>'ok','refresh'=>true),'json');
			}else{
				$this->ajaxReturn(array('title'=>'设置失败','message'=>$model->getError(),'status'=>'error'),'json');
			}
		}
	}
	
	//账号安全保护
	public function idsecurityAction(){
		if(intval($_GET['mobile'])){
			//移动
		}else{
			//模块
			$model=new \Member\Model\MemberModel();
			if($model->UpdateMember('idsecurity')){
				$this->ajaxReturn(array('title'=>'设置成功','message'=>'设置成功!','status'=>'ok','refresh'=>true),'json');
			}else{
				$this->ajaxReturn(array('title'=>'设置失败','message'=>$model->getError(),'status'=>'error'),'json');
			}
		}
	}
	
	//我的位置
	public function locationAction(){
		if(intval($_GET['mobile'])){
			//移动
		}else{
			//模块
			$model=new \Member\Model\MemberModel();
			if($model->UpdateMember('location')){
				$this->ajaxReturn(array('title'=>'设置成功','message'=>'设置成功!','status'=>'ok','refresh'=>true),'json');
			}else{
				$this->ajaxReturn(array('title'=>'设置失败','message'=>$model->getError(),'status'=>'error'),'json');
			}
		}
	}
}